<template>
	<view class="page">
		<!-- 头部 -->
		<!-- #ifdef MP-WEIXIN -->
			<topVue>
				<view class="slotVue">
					<image
						src="../../../static/back.png" 
						style="width: 38rpx; height: 38rpx; left: 30rpx;" 
						class="absolute-middle"
						@click="$tools.back(1)"
					></image>
					<text class="fw600 fs32 absolute-auto">实名认证</text>
				</view>
			</topVue>
		<!-- #endif -->
		<view class="label">请上传你的身份证照片</view>
		
		<view class="box margin0 flex-between">
			<view class="boxLi" @click="choose_z()">
				<view class="inner relative">
					<image :src="img_z" style="width: 100%; height: 100%;" v-if="img_z"></image>
					<template v-else>
						<image src="../../../static/person/z.png" mode="widthFix"></image>
						<image src="../../../static/person/up.png" style="width: 60rpx; height: 46rpx;" class="absolute-auto"></image>
					</template>
				</view>
			</view>
			<view class="boxLi" @click="choose_f()">
				<view class="inner relative">
					<image :src="img_f" style="width: 100%; height: 100%;" v-if="img_f"></image>
					<template v-else>
						<image src="../../../static/person/f.png" mode="widthFix"></image>
						<image src="../../../static/person/up.png" style="width: 60rpx; height: 46rpx;" class="absolute-auto"></image>
					</template>
				</view>
			</view>
		</view>
		
		<view class="inpVue margin40">
			<view class="fw600">真实姓名</view>
			<input type="text" placeholder="输入真实姓名" placeholder-style="color: #999; font-size: 28rpx;" v-model="name"/>
		</view>
		<view class="inpVue margin40">
			<view class="fw600">身份证</view>
			<input type="text" placeholder="输入身份证号码" placeholder-style="color: #999; font-size: 28rpx;" v-model="idCard"/>
		</view>
		
		<view class="botVue flex-center align-center">
			<view class="apply fs30 fw600" @click="applyFun()">提交审核</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				name: "",
				idCard: "",
				img_z: "",
				img_f: ""
			}
		},
		methods: {
			choose_z(){
				let that = this
				uni.chooseImage({
					count: 1,
					success(res){
						console.log(res)
						that.img_z = res.tempFilePaths[0]
					}
				})
			},
			choose_f(){
				let that = this
				uni.chooseImage({
					count: 1,
					success(res){
						console.log(res)
						that.img_f = res.tempFilePaths[0]
					}
				})
			},
			// 提交申请
			applyFun(){
				if(!this.img_z) return this.$u.toast("请上传你的身份证正面")
				if(!this.img_f) return this.$u.toast("请上传你的身份证反面")
				if(!this.name) return this.$u.toast("请输入真实姓名")
				if(!this.idCard) return this.$u.toast("请输入身份证号码")
			}
		}
	}
</script>

<style lang="less" scoped>
	.label {
		color: #999999;
		padding: 50rpx 0 30rpx 30rpx;
	}
	.box {
		width: 690rpx;
		height: 220rpx;
		.boxLi {
			width: 330rpx;
			height: 220rpx;
			background: #FBFBFD;
			padding: 32rpx 18rpx;
			.inner {
				width: 100%;
				height: 100%;
				background: url("../../../static/person/box.png") no-repeat;
				background-size: cover;
			}
		}
	}
	.inpVue {
		width: 690rpx;
		border-bottom: #eee 1px solid;
		padding: 30rpx 0;
		input {
			color: #333;
			font-size: 28rpx;
			display: block;
			margin-top: 30rpx;
		}
	}
	.botVue {
		width: 100%;
		height: 160rpx;
		background: #fff;
		position: fixed;
		left: 0;
		bottom: 0;
		.apply {
			width: 640rpx;
			height: 96rpx;
			background: #FC132F;
			border-radius: 48rpx;
			text-align: center;
			line-height: 96rpx;
			color: #FFFFFF;
		}
	}
</style>